WEBVTT

00:00.770 --> 00:03.800
Welcome to the third step of our final project.

00:03.800 --> 00:10.850
And in the last video we rebuilt marriage passport folio and at first glance the past performance looks

00:11.030 --> 00:12.970
pretty terrific here.

00:12.980 --> 00:19.520
However in the past marriage has not closely monitored the performance of our portfolio and based on

00:19.580 --> 00:23.360
the impressive result over the total twenty two years period.

00:23.360 --> 00:30.560
She may be overestimates the performance and in a very first meeting she is set for investment periods

00:30.560 --> 00:32.450
of six years or longer.

00:32.450 --> 00:39.830
I never lost money with my portfolio and the question is here is she right and this is actually the

00:39.830 --> 00:43.560
perfect application case for a return triangle.

00:43.580 --> 00:50.760
We have still imparted our healthcare index and in a next step we change the frequency of our healthcare

00:50.870 --> 00:54.220
index from daily to annual frequency.

00:54.770 --> 01:02.600
And of course we can do the service of the every sample method and we have here and yellow and the for

01:02.600 --> 01:06.760
each and every period for each and every year we want to have the very last.

01:06.800 --> 01:13.730
Trading Prize and by running the sale here we would get a panda series and we can also convert the panda

01:13.730 --> 01:17.620
series to a data frame with the method to frame.

01:17.690 --> 01:25.680
And finally we save the data frame and the available annual so that's at the annual Values for our new

01:25.680 --> 01:33.210
index starting with 100 at the end of nineteen hundred ninety six and over eight hundred here.

01:33.420 --> 01:40.440
And so the column label as health care here and we can change the column label to for example price.

01:40.740 --> 01:43.980
So that's more meaningful here.

01:43.980 --> 01:46.100
And then we add another column called return.

01:46.650 --> 01:53.490
And here we calculate the lock return or the annual lock return of our prices.

01:53.490 --> 01:59.910
And of course we can do this here with the number pi method and Peter lock and we divide each price

01:59.940 --> 02:05.120
by the immediately preceding price of the preceding year.

02:05.160 --> 02:11.550
So let's do this here and then we actually drop the very first row where we have an A values in the

02:11.550 --> 02:14.530
return column and several up here.

02:15.150 --> 02:19.620
So here we have the prices and uh the lock returns.

02:19.770 --> 02:24.720
Starting from nineteen hundred ninety seven and two thousand and eighteen.

02:25.050 --> 02:31.300
And that sum total twenty two years or twenty two periods and we can also determine this uh with uh

02:31.350 --> 02:39.390
the index attribute and then getting the size of our index and we say actually 22 and the variable years

02:41.640 --> 02:49.730
and then the next step we create a list starting with 22 until 1 and we assign the variable windows.

02:49.770 --> 02:56.100
So this is here a list comprehension.

02:56.300 --> 03:01.630
And then finally we create the 22 new columns uh for our annual data frame.

03:01.880 --> 03:06.050
And these columns are actually rolling statistics.

03:06.200 --> 03:13.700
So we have the rolling mean return for Windows starting from twenty two years until only one year and

03:13.760 --> 03:20.980
we can do this here with a for loop and we iterate over the windows list starting with 22.

03:21.350 --> 03:26.960
So we're creating first of all the column with the column label twenty two years.

03:26.960 --> 03:33.170
And here we calculate the rolling mean return with a window of twenty two years.

03:33.350 --> 03:37.280
And that's what we exactly doing for all elements in the windows list.

03:37.340 --> 03:41.610
So let's run the sale here and let's have a look again at our annual data frame.

03:41.660 --> 03:49.520
So still we a fair price and a return as columns and we have a year rolling mean returns twenty two

03:49.520 --> 03:56.620
years until a one year and finally we dropped the columns the price and return and we save for the new

03:56.620 --> 03:58.870
data frame and the rabbit triangle

04:02.330 --> 04:05.640
and now we are finally prepared to plot our return triangle.

04:06.020 --> 04:13.580
And we can do this with a seaborne heat map and we pass our triangle data frame to S.A. that heat map.

04:13.940 --> 04:15.980
And it's always a bit tricky to determine.

04:15.990 --> 04:23.540
We men we max and center but with returns that always make sense to our faith center of 0 percent.

04:23.630 --> 04:26.350
So no positive or negative return.

04:26.360 --> 04:30.230
And we sat here we max to 15 percent.

04:30.230 --> 04:36.050
So we have deep green fourth that's where we have never it's return of 15 percent or more.

04:36.410 --> 04:40.940
And we determined we mean as being minus 10 percent.

04:40.940 --> 04:42.770
So let's create here the plot

04:49.470 --> 04:54.070
so that's the return triangle for our customized index.

04:54.300 --> 04:57.810
And we can see here that is only very little red.

04:58.200 --> 05:04.670
So here we have said during the dot com crisis some reds and also he and the financial crisis.

05:05.250 --> 05:09.870
But the overall performance of our index remains pretty terrific here.

05:10.260 --> 05:12.570
So a lot of green here.

05:12.570 --> 05:20.910
And the final question is do we find any a period with six years or longer that the average return is

05:20.940 --> 05:29.180
negative or in other words do we find any investment period of six years or longer where Mary lost money

05:29.200 --> 05:30.630
with her portfolio.

05:30.780 --> 05:40.470
And obviously if you go here to nine years then we can see an average return of minus 0.01 percent.

05:40.800 --> 05:49.220
And it's actually no surprise that this is the nine year period from 2001 to 2009 including uh the dot

05:49.220 --> 05:52.550
com bubble and also the financial crisis.

05:52.650 --> 05:58.650
But as a summary we can say that Mary was not right and she kind of well estimated the performance of

05:58.650 --> 06:06.050
our portfolio and with this we are finishing with part three and we will continue in part for us.

06:06.060 --> 06:07.680
So hope to see there by.
